import service from "../serviceIndex";
// 购物车列表
export const cartListAPI = (userId) => {
    return service({
        method: 'get',
        url: `/pipayshopapi/shopcart/selectItemCartByIds/${userId}`
    })
};
// 根据商品id，查找买家发货地址
export const getOriginAddressByIdAPI = (commodityId) => {
        return service({
            method: 'get',
            url: `/pipayshopapi/item-commodity-info/getOriginAddressById/${commodityId}`
        })
    }
    // 买家信息
export const BuyersAPI = (userId) => {
        return service({
            method: 'get',
            url: `/pipayshopapi/buyer-data/selectAllAddress/${userId}`
        })
    }
    // 删除购物车
export const deleteAPI = (userId, cartIds) => {
    return service({
        method: 'post',
        url: `/pipayshopapi/shopcart/deleteShopCart/${userId}`,
        data: cartIds// 直接传递数组
    });
    }
    // 管理网店商品数量和shopid
export const manageAPI = (userId) => {
        return service({
            method: 'get',
            url: `/pipayshopapi/user-info/getItemInfoByUid/${userId}`
        })
    }
    // 网店商品列表
export const itemListAPI = ({ shopId, page, limit, isDesc }) => {
        return service({
            method: 'get',
            url: `/pipayshopapi/shop/getAllItemInfo/${shopId}/${page}/${limit}/${isDesc}`
        })
    }

    export const getShopInfo = (userId) => {
        return service({
            method: 'get',
            url: `/pipayshopapi/shop/getItemInfoByUid/${userId}`
        })
    }

    // 判断是否为vip
export const isVipAPI = (userId) => {
        return service({
            method: 'get',
            url: `/pipayshopapi/shop/isVip/${userId}`
        })
    }
    // 升级为vip
export const upVipAPI = (userId) => {
        return service({
            method: 'post',
            url: `/pipayshopapi/item-info/upVip/${userId}`
        })
    }
    // 根据用户Id查找用户账户表的积分余额和pi币余额
export const selectAccountByIdAPI = (uid) => {
        return service({
            method: 'post',
            url: `/pipayshopapi/account-info/selectAccountById/${uid}`
        })
    }
    // 支付下单
export const payOrderAPI = (token) => {
    return service({
        method: "post",
        url: `/pipayshopapi/item-order/payOrder`,
        params: {
            token,
        },
    });
};
//根据商品id，下架变为审核中
export const changeCommodityStatusAPI = (commodityId) => {
        return service({
            method: 'post',
            url: `/pipayshopapi/item-commodity-info/changeCommodityStatus/${commodityId}`,
        })
    }
    //根据商品id，上架变为下架
export const changeCommodityUpAPI = (commodityId,status) => {
    return service({
        method: 'get',
        url: `/pipayshopapi/commodity/upOrdown/${commodityId}/${status}`,
    })
}